// ec-canvas/util.js
import * as echarts from './echarts';

let getChartOnInit = function (option, that) {
  return function (canvas, width, height) {
    const chart = echarts.init(canvas, null, {
      width: width,
      height: height
    });
    canvas.setChart(chart);
    chart.setOption(option);


    return chart;
  }
}

let getChart = function (option, that) {
  return {
    onInit: getChartOnInit(option, that)
  }
}


module.exports = {
  getChartOnInit,
  getChart
}